<?php

require_once( 'mvc/controller-factory.php' );
require_once( 'mvc/dynamo-info.php' );

class Flexical_Admin_Controller_Factory extends MVC_Controller_Factory
{
	private $controllers = array();

	public function __construct()
	{
		$info = new MVC_Dynamo_Info( 'flexical/admin/about-controller.php', 'Flexical_Admin_About_Controller' );
		$this->controllers[ 'Flexical_Admin_Null_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_About_Request' ] = $info;

		$info = new MVC_Dynamo_Info( 'flexical/admin/feed-controller.php', 'Flexical_Admin_Feed_Controller' );
		$this->controllers[ 'Flexical_Admin_Feed_CUD_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Show_Feeds_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Delete_All_Feeds_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Confirm_Delete_Feed_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Edit_Feed_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Import_Feeds_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Test_Feed_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Test_All_Feeds_Request' ] = $info;

		$info = new MVC_Dynamo_Info( 'flexical/admin/query-controller.php', 'Flexical_Admin_Query_Controller' );
		$this->controllers[ 'Flexical_Admin_Show_Queries_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Create_Query_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Update_Query_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Delete_Query_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Edit_Query_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Confirm_Delete_Query_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Delete_All_Queries_Request' ] = $info;

		$info = new MVC_Dynamo_Info( 'flexical/admin/format-controller.php', 'Flexical_Admin_Format_Controller' );
		$this->controllers[ 'Flexical_Admin_Show_Formats_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Create_Format_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Update_Format_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Delete_Format_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Edit_Format_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_View_Format_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Confirm_Delete_Format_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Delete_All_Formats_Request' ] = $info;

		$info = new MVC_Dynamo_Info( 'flexical/admin/listing-controller.php', 'Flexical_Admin_Listing_Controller' );
		$this->controllers[ 'Flexical_Admin_Show_Listings_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Create_Listing_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Update_Listing_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Delete_Listing_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Edit_Listing_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Test_Listing_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Confirm_Delete_Listing_Request' ] = $info;
		$this->controllers[ 'Flexical_Admin_Delete_All_Listings_Request' ] = $info;

		$info = new MVC_Dynamo_Info( 'flexical/admin/error-controller.php', 'Flexical_Admin_Error_Controller' );
		$this->controllers[ 'Flexical_Admin_Unknown_Request_Type_Request' ] = $info;
	}

	public function get_controller( $request = null )
	{
		$controller = null;

		if ( isset( $this->controllers[ get_class( $request ) ] ) )
		{
			$controller = $this->controllers[ get_class( $request ) ]->new_instance();
		}

		return $controller;
	}
}

?>
